<?php
use yii\helpers\Html;
use yii\widgets\Breadcrumbs;
use frontend\assets\AppAsset;
use yii\widgets\LinkPager;
use frontend\controllers\MessageController;
use common\models\articles\Articles;
use common\models\member\Member;
use common\models\category\Category;

    $tongzhi = Articles::find()->where(['category_id'=>18, 'status' => Articles::STATUS_ACTIVE])->asArray()->limit(9)->all();
    $zhengce = Articles::find()->where(['category_id'=>25, 'status' => Articles::STATUS_ACTIVE])->asArray()->limit(9)->all();
    $hangye = Articles::find()->where(['category_id'=>28, 'status' => Articles::STATUS_ACTIVE])->asArray()->limit(9)->all();
    $pinpai = Articles::find()->where(['category_id'=>23, 'status' => Articles::STATUS_ACTIVE])->asArray()->limit(9)->all();
    $xinwen = Articles::find()->where(['category_id'=>14, 'status' => Articles::STATUS_ACTIVE])->asArray()->limit(9)->all();
        // 会员风采
    $memberstyle = Member::find()->where(['status' => Member::STATUS_SUCCESS])->asArray()->limit(9)->all();
    $membersytletype = Category::find()->where(['id' =>20])->asArray()->one()['ctype'];

?>
<style>
.page{
    zoom: 1;
    overflow: hidden;
}
.pagination{
    zoom:1;
    overflow: hidden;
    float:right;
}
.pagination li{
    border: 1px solid #cfcfcf;
    border-radius: 5px;
    -webkit-border-radius: 5px;
    -moz-border-radius: 5px;
    padding: 3px 13px;
    margin: 0 2px;
    float: left;
}
.page a{
    border: none;
    padding: 0;
    margin: 0;
}
.page a:hover{
    border: 0;
}
.pagination .active{
    background: #a42023;
    color: #fff;
    border: 1px solid #a42023;
    border-radius: 5px;
    -webkit-border-radius: 5px;
    -moz-border-radius: 5px;
}
.pagination .active a{
    color: #fff;
}
.pagination li:hover{

}
</style>  <!--content-->
    <div class="content">
        <div class="w1113 bgd-ff mt10 mb10" style="margin-bottom:10px; margin-top:10px;">
            <span class="abwz">
                您所在的位置：<a href="<?= yii\helpers\Url::to(['/']);?>">首页</a> > 
                <a href="<?= yii\helpers\Url::to([$parentinfo['type'], 'id' => $parentinfo['id']]); ?>"><?= $parenttitle; ?></a> >
                <a> <?= $title; ?></a>
            </span>
        </div>
        <div class="w1113 bgd-ff">
            <div class="clearFloat pl20 pr20 pt15 pb50">
                <div class="ableft floatLeft">
                    <div class="ablewidt">
                        <h3 class="anh3"><?php echo $parenttitle; ?></h3>
                        <div class="jquery-accordion-menu">
                            <ul  class="acb">
                                <?php foreach($childcat as $t){ ?>

                                    <li<?php if($id == $t['id']){echo ' class="active"';} ?>>
                                        <?php if(!empty($t['url'])){ ?>
                                            <a href="<?= $t['url']; ?>"><?=$t['name']; ?></a>
                                        <?php }else{ ?>
                                            <a href="<?= yii\helpers\Url::to([$t['type'], 'id' => $t['id']]); ?>"><?=$t['name']; ?></a>
                                        <?php  } ?>
                                    </li>

                                <?php } ?>
                            </ul>
                        </div>
                    </div>
                    <script type="text/javascript">
                        jQuery(document).ready(function () {
                            jQuery(".jquery-accordion-menu").jqueryAccordionMenu();

                        });

                        $(function(){
                            //顶部导航切换
                            $(".acb li").click(function(){
                                $(".acb li.active").removeClass("active")
                                $(this).addClass("active");
                            })
                        })
                    </script>
                </div>
                <div class="abright floatRight">
                    <div class="abrwidth">
                        <div class="clearFloat listwidt">
                            <div class="clearFloat mt40 mb40">
                                <div class="clearFloat text-center">
                                    <a href="<?= yii\helpers\Url::to(['message/page']);?>">
                                        <img src="../../images/liyan.png" alt="" width="716" height="388">
                                    </a>
                                </div>
                                <div class="lybdiv">
                                    <h3 class="lybtit"><?php echo $title; ?></h3>
                                    <ul class="lybup">
                                        <?php foreach($articles as $k=>$t){ ?>
                                        <li <?php if(($k+1)%6 ==0){echo ' class="mb60"';} ?>>
                                            <strong><?php if(strlen($t['user']) == 3) { echo $t['user']; }else{echo mb_substr(strip_tags($t['user']),0,1,'utf-8')."**";} ?>:</strong>
                                            <?php if(strlen($t['content']) < 147) { ?>
                                            <span class="lyspanh1"><?= $t['content']; ?></span>                                            
                                            <?php } ?>
                                            <?php if((strlen($t['content']) > 144)&&(strlen($t['content']) < 291)) { ?>
                                            <span class="lyspanh2"><?= mb_substr(strip_tags($t['content']),0,70,'utf-8'); ?></span>
                                            <?php } ?>
                                            <?php if(strlen($t['content']) > 288) { ?>
                                            <span class="lyspanh3"><?= mb_substr(strip_tags($t['content']),0,70,'utf-8')."..."; ?></span>
                                            <a class="lybsub3">查看留言>></a><a class="lybsubw3">收起留言>></a> 
                                            <input type="hidden" value="<?= $t['content']; ?>" id="allcontent">
                                            <input type="hidden" value="<?= mb_substr(strip_tags($t['content']),0,70,'utf-8').'...'; ?>" id="shortcontent">
                                            <?php } ?>
                                            <span class="lybtime"><?= date('Y-m-d H:i:s',$t['create_time']);?></span>
                                        </li>
                                        <?php } ?>
                                    </ul>
                                </div>
                                <style> 
                                   .lyspanh1,.lyspanh2,.lyspanh3{
                                       display: block;
                                   }
                                   .lybsubw3{
                                      display: none;
                                   }
                                </style>

                                <div class="page mt50 mb10">
                                    <?php if($page)
                                    {
                                        echo LinkPager::widget([
                                        'maxButtonCount' => 6,
                                        'prevPageLabel' =>'上一页',
                                        'nextPageLabel' =>'下一页',
                                        'pagination'=>$page,
                                    ]);
                                    }
                                    ?>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script>
        $(function () {
            $(".lyspanh3").css({"height":"70px","display":"block","overflow":"hidden"});
            $(".lybsubw3").hide();
            $(".lybsub3").click(function () {
                $(this).hide();
                $(this).siblings(".lybsubw3").show();
                $(this).siblings(".lyspanh3").css({"height":"auto","overflow":"visible"});
                $(this).siblings(".lyspanh3").html($("#allcontent").val())
            })
            $(".lybsubw3").click(function () {
                $(this).hide();
                $(this).siblings(".lybsub3").show();
                $(this).siblings(".lyspanh3").css({"height":"70px","display":"block","overflow":"hidden"});
                $(this).siblings(".lyspanh3").html($("#shortcontent").val())
            })
        })
    </script>

    <!--content end-->